package com.hw.spark.listener;

import org.apache.spark.streaming.scheduler.StreamingListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//spark的监听器：SparkListener，JavaSparkListener，JavaStreamingListener...等

public class SparkStreamListener implements StreamingListener {
	
	private static final Logger log = LoggerFactory.getLogger(SparkStreamListener.class);

	public void onStreamingStarted() {
		log.info("--------------------------------------stream启动-------------------------------");
	}

	public void onReceiverStarted() {
		log.info("--------------------------------------开始接收-------------------------------");
	}

	public void onReceiverStopped() {
		log.info("--------------------------------------接收完毕-------------------------------");
	}

	public void onBatchSubmitted() {
		log.info("--------------------------------------批次提交-------------------------------");
	}

	public void onBatchCompleted() {
		log.info("--------------------------------------批次完成-------------------------------");
	}

	public void onOutputOperationCompleted() {
		log.info("--------------------------------------操作完毕-------------------------------");
		System.exit(0);
	}
}